#!/usr/bin/perl
#file:	hc_linux_cpu
#time:	2008.09
#author: joecen
#site:  http://www.joecen.com/hcacti

open(CPU,"/proc/stat") or die("Error: Open file '/proc/stat' fail!");
my @all_cpu_stat=grep(/cpu\s+/,<CPU>);
my @cpu_stat = split(/\s+/,$all_cpu_stat[0]);
print "cpu_user=".$cpu_stat[1].",cpu_nice=".$cpu_stat[2].",cpu_syst=".$cpu_stat[3].",cpu_idle=".$cpu_stat[4].",cpu_wait=".$cpu_stat[5].",cpu_intr=".$cpu_stat[6].",cpu_sitr=".$cpu_stat[7];
